package com.five.wisdomEat.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.five.wisdomEat.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    //查询所有评论
    @Select("SELECT * FROM comment")
    List<Comment> selectCommentList();

    //添加评论
    @Insert("INSERT INTO comment (id,c_content,c_time,c_d_number) VALUES (null,#{cContent},#{cTime},#{cDNumber})")
    Integer insertComment(Comment comment);

    //根据id修改评论
    @Update("UPDATE comment SET c_content=#{cContent},c_time=#{cTime},c_d_number=#{cDNumber} WHERE id = #{id}")
    Integer updateComment(Comment comment);

    //根据id删除评论
    @Delete("DELETE FROM comment WHERE id = #{id}")
    Integer deleteComment(Integer id);
}
